home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / Barfly / Source / ppcmacros.i < prev    next >
Text File  |  1998-03-29  |  2KB  |  113 lines

  1.     IFND    ppcmacros_i
  2. ppcmacros_i    set    1
  3.  
  4.  
  5.  
  6. ******* ppcmacros.i/LAPC ************************************************
  7. *
  8. *   MACRO
  9. *        LAPC -- Load PC-Relativ Address into Register
  10. *
  11. *   SYNOPSIS
  12. *        LAPC    register,label
  13. *
  14. *   INPUTS
  15. *        \1 = Destination Register
  16. *        \2 = Symbol that gets address PC
  17. *
  18. *   SEE ALSO
  19. *        PPC standard macro "la",,ppcsymbols.i
  20. *
  21. *******************************************************************************
  22.  
  23. LAPC        macro
  24.     bl        LAPC\@
  25. LAPC\@:
  26.     mfspr        \1,lr
  27.     addi        \1,\1,#\2-LAPC\@
  28.     ENDM
  29.  
  30. LALPC        macro
  31.     bl        LALPC\@
  32. LALPC\@:
  33.     mfspr        \1,lr
  34.     LIL        \3,\2-LALPC\@
  35.     add        \1,\1,\3
  36.     ENDM
  37.  
  38.  
  39. ******* ppcmacros.i/LIL ************************************************
  40. *
  41. *   MACRO
  42. *        LIL -- Load LongValue into Register
  43. *
  44. *   SYNOPSIS
  45. *        LIL    register,value
  46. *
  47. *   INPUTS
  48. *        \1 = Destination Register
  49. *        \2 = Value
  50. *
  51. *   SEE ALSO
  52. *        PPC standard macro "li",ppcsymbols.i
  53. *
  54. *******************************************************************************
  55.  
  56. LIL    macro
  57.     addis        \1,0,#((\2)&$ffff0000)>>16    ;= HighWord of value | Highword of value
  58.     ori        \1,\1,#(\2)&$ffff        ;= LowWord) of value
  59.     ENDM
  60.  
  61. ******* ppcmacros.i/LIW ************************************************
  62. *
  63. *   MACRO
  64. *        LIW -- Load LongValue into Register
  65. *
  66. *   SYNOPSIS
  67. *        LIW    register,value
  68. *
  69. *   INPUTS
  70. *        \1 = Destination Register
  71. *        \2 = Value
  72. *
  73. *   SEE ALSO
  74. *        PPC standard macro "li",ppcsymbols.i
  75. *
  76. *******************************************************************************
  77.  
  78. LIW    macro
  79.     IFNE    \2&$8000                ;If signed Bit..then use or
  80.     subf        \1,\1,\1            ;Clear register
  81.     ori        \1,\1,#(\2)&$ffff        ;Load lowword
  82.     ELSE
  83. ;    subf        \1,\1,\1            ;Clear register
  84.     addi        \1,0,#(\2)&$ffff        ;just load it
  85.     ENDC
  86.  
  87.     ENDM
  88.  
  89.  
  90. ******* ppcmacros.i/CLEAR ************************************************
  91. *
  92. *   MACRO
  93. *        CLEAR -- Clear Register
  94. *
  95. *   SYNOPSIS
  96. *        CLEAR    register
  97. *
  98. *   INPUTS
  99. *        \1 = Destination Register
  100. *
  101. *******************************************************************************
  102.  
  103. CLEAR    macro
  104.     subf        \1,\1,\1
  105.     ENDM
  106.  
  107.  
  108.  
  109.  
  110.  
  111.     ENDC    ;ppcmacros_i
  112.  
  113.